const shareData = {
  title: '奥托立夫2025上海车展', // 分享标题
    desc: ' ', // 分享描述
    link: location.href.includes('/pages/punckClock/photo')?location.href:location.href.split('#')[0], // 分享链接
    imgUrl: 'https://web.skyelook.com/capsule2025/autoliv/auto-share.jpg'
}

module.exports = {
  initShare(){
    let that = this;
    uni.request({
      url: 'https://open.skyelook.com/api/adidas/share',
      method: 'POST',
      header: {
        "Content-Type": "application/x-www-form-urlencoded",
      },
      data: {
        url: (window.location.href.split('#'))[0]
      },
      success(res) {
        let config = res.data.data.config;
        that.jweixin.config(config);
        that.jweixin.ready(()=>{
          that.share();
        });
      },
      fail(erro) {
    
      }
    })
  },
  share(link=''){
    console.log(link,'share')
    //分享给朋友接口
    this.jweixin.updateAppMessageShareData({
      ...shareData,
      link:link||shareData.link
    });
      //分享到朋友圈接口  
    this.jweixin.updateTimelineShareData({
      ...shareData,
      link:link||shareData.link
    });
  }
}